from playwright.sync_api import sync_playwright
 
def headful_mode_example():
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=True)  # 默认是有头模式，为确保有头可以明确指定有头模式
        page = browser.new_page()
        page.goto("https://www.example.com")
        print("Page title:", page.title())
        browser.close()
 
headful_mode_example()